package com.zxy;

import java.util.Scanner;

public class zrh04 {
    public static void main(String[] args) {
        String username = "zs";
        String password = "123321";
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            System.out.println("请输入用户名：");
            String un = sc.next();
            System.out.println("请输入密码：");
            String pw = sc.next();
            if (un.equals(username) && pw.equals(password)) {
                System.out.println("登陆成功！");
                break;
            }else{
                if(i==2){
                    System.out.println("机会用完，拜拜了您内");
                    break;
                }
                System.out.println("输入错误，您还有"+(2-i)+"次机会");
            }
        }
    }
}
